<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@ taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@	page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<c-rt:set var="tp" value="${pu:pageableTag('tpp', 10, 10)}"/>
<c-rt:set var="hql">
from LoginLog where memberId = ? and loginTime between ? and ? order by createDate desc
</c-rt:set>
<c-rt:set var="endDateParamTime">${endDateParam} 23:59:59</c-rt:set>
<c-rt:set var="params" value="${pu:addToList('paras', param.memberId)}"/>
<c-rt:set var="params" value="${pu:addToList('paras', pu:toDate(startDateParam,'yyyy-MM-dd'))}"/>
<c-rt:set var="params" value="${pu:addToList('paras', pu:toDate(endDateParamTime,'yyyy-MM-dd HH:MM:ss'))}"/>
<c-rt:set var="loginLogs" value="${pu:queryByHql(hql, params, tp)}"/>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="${midContextPath}/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="${midContextPath}/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="${midContextPath}/css/smoothness.datepick.css" />
<script language="javascript">
$().ready( function() {
	$('#llstartDateParam').datepick({minDate: null, maxDate: new Date(), showOn: 'both', 
    	buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd",yearRange: '-3:+3'}); 
	$('#llendDateParam').datepick({minDate: null, maxDate: new Date(), showOn: 'both', 
    	buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd",yearRange: '-3:+3'}); 
	$('#llsendData').click(function(){
		doAR('${midContextPath}/member/searchLoginHistory.do?AJAX=true&refreshZone=tabs-11', 'tabs-11', 'loginHistoryForm');
	});
});
</script>
<div class="data-form">
<s:form name="loginHistoryForm" method="post">
	<b>日期区间：</b>
	<input name="startDateParam" type="text" id="llstartDateParam"
		value="${startDateParam}" size="10" maxlength="10">
    ~ 
  <input name="endDateParam" type="text" id="llendDateParam"
		value="${endDateParam}" size="10" maxlength="10">
	<input type="hidden" name="memberId" value="${memberId}"/>
	<input type="button" id="llsendData" value="搜寻"/>
</s:form>
</div>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>#</th>
			<th>登录日期时间</th>
			<th>登录来源IP</th>
			<th>登录成功否</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${loginLogs}" var="loginLog" varStatus="rows_index">
			<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
				<td>${loginLog.id}</td>
				<td><fmt:formatDate value="${loginLog.loginTime}"  pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>${loginLog.clientIp}</td>
				<td><c-rt:if test="${loginLog.isSuccess == 0}">成功</c-rt:if><c-rt:if test="${loginLog.isSuccess == 1 || loginLog.isSuccess == 2}">失败</c-rt:if></td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<pageable:Pageable url="${midContextPath}/member/searchLoginHistory.do" parameter="AJAX=true&refreshZone=tabs-11" escapeparams="AJAX,refreshZone" formname="NewLoginLogForm" key="tpp"></pageable:Pageable>